home *** CD-ROM | disk | FTP | other *** search
- **********************************************************************************************************************
- ** Written by Dino Papararo 12-December-2001
- **
- ** FUNCTION
- **
- ** JulianPPC -- perform Z = (Z^(2^n)) + C (1 <= n <= 11)
- **
- ** SYNOPSIS
- **
- ** ULONG JulianPPC (ULONG Iterations,ULONG Power,long double Cre,long double Cim,long double JKre,long double JKim)
- **
- **
- ** This function tests if a point belongs or not at Julia set
- **
- ** Optimized for pipelines of PPC processors.
- **
- ** r3:Iterations r4:Power
- ** f1:Cre/Zr f2:Cim/Zi f3:JKre f4:JKim f5:Zr2 f6:Zi2 f7:Dist f8:MaxDist
- **********************************************************************************************************************
-
-
- include powerpc/ppcmacros.i
- include powerpc/powerpc.i
-
- ; xref _PowerPCBase
-
- xdef _JulianPPC
-
- section code
-
- cpu POWERPC
-
- _JulianPPC
-
- prolog ; start
-
- lf f8,Radius ; MaxDist = Radius
- b+ .Loop2 ; go to Loop2
-
- .Loop1
- mfctr r3 ; Iterations = Counter
- .Loop2
- mtctr r4 ; Counter = Power
- .Loop3
- fmul f6,f2,f2 ; zi2 = zi * zi
- fmul f5,f1,f1 ; zr2 = zr * zr
- fmul f2,f1,f2 ; zi = zr * zi
- fsub f1,f5,f6 ; zr = zr2 - zi2
- fadd f2,f2,f2 ; zi = zi + zi
- bdnz .Loop3 ; if --Counter > 0 go to Loop3
-
- mtctr r3 ; Counter = Iterations
- fadd f7,f5,f6 ; Dist = zr2 + zi2
- fadd f1,f1,f3 ; zr = zr + JKre
- fadd f2,f2,f4 ; zi = zi + JKim
- fcmpu f7,f8 ; compare Dist with MaxDist
- bdnzf+ GT,.Loop1 ; if Dist < MaxDist and --Counter > 0 go to Loop1
- ****************************************************************************************
-
- .End
-
- mfctr r3 ; Iterations = Counter
-
- epilog ; end
-
- save
- data
-
- align.d
- Radius dc.d 4.0
-
- restore
-